tongfusoft.header = function() {
}
var currUserId = "";
tongfusoft.header.prototype = {
		currUser : function(){
			common.post('currUser', {
			}, function(data) {
				if (data.state == 'success') {
					currUserId = data.data.userId;
					$("#changePassword").attr("title",data.data.loginName);
				}
			});
			$("#changePassword").click(function() {
				window.location.href=common.getContextPath("manager/user/editPage/?userId="+currUserId+"&&opr=repassword");
			});
		},
		
		notice : function(pageIndex,pageSize){
			common.post('personalCenter/notice/getNumber', {"userId":currUserId}, function(data) {
				if (data.state == 'success') {
					$("#noticeNumber").text(data.data.length);
					if((data.data.length-pageSize)>0){
						$("#noticeNumbernext").text((data.data.length-pageSize));
					}else{
						$("#noticeNumbernext").text(0);
					}
					
				}
			});
			common.post('personalCenter/notice/getNumberPage', {"userId":currUserId,"pageIndex":pageIndex,"pageSize":pageSize}, function(data) {
					
					var noticeListHtml = "";
					$.each(data.list,function(index,item){
						noticeListHtml = noticeListHtml + '<a href="#" docname="'+item.docName+'" onclick="new tongfusoft.header().detail(this)" class="list-group-item">';
						noticeListHtml = noticeListHtml + '<div class="media-box">';
						noticeListHtml = noticeListHtml + '<div class="pull-left">';
						noticeListHtml = noticeListHtml + '<em class="fa fa-envelope fa-2x text-warning"></em>';
						noticeListHtml = noticeListHtml + '</div>';
						noticeListHtml = noticeListHtml + '<div class="media-box-body clearfix">';
						noticeListHtml = noticeListHtml + '<p class="m0">'+item.docTitle+' '+item.noticeInfo+'</p>';
						noticeListHtml = noticeListHtml + '</div>';
						noticeListHtml = noticeListHtml + '</div>';
						noticeListHtml = noticeListHtml + '</a>';
					});
					$("#noticeList").html(noticeListHtml);
			});
		},
		detail : function(obj){
			window.location.href=common.getContextPath('docView/'+$("#returnPage").val()+'/'+$(obj).attr("docName"));
		},
		myNotice: function(){
			$("#myNotice").click(function() {
				window.location.href=common.getContextPath("personalCenter/myNotice");
			});
		}
}
$(function(){
	var header = new tongfusoft.header();
	header.currUser();
	header.notice(1,2);
	header.myNotice();
})